#include <iostream>
#include <vector>
using namespace std;

int rob(vector<int> &h)
{
        int n = h.size();
        vector<int> dp(n, 0);
        dp[0] = h[0];
        dp[1] = max(h[0], h[1]);
        for(int i = 2; i < n; i++){
                dp[i] = dp[i - 1];
                dp[i] = max(dp[i], dp[i - 2] + h[i]);
        }
        return dp.back();
}

int main()
{
        int t = 0;
        cin >> t;
        while(t--){
                int n;
                cin>>n;
                vector<int> horse(n, 0);
                for(int i = 0; i < n; i++){
                        cin >> horse[i];
                }
                cout<<rob(horse)<<endl;
        }
        return 0;
}